﻿<!DOCTYPE HTML>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>
        优质水会 > 丽丝水会
    </title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="generator" content="" data-variable="/,cn,10001,,10001,res032" />
    <link rel='stylesheet' href='css/index.css'>
    <style>
        /* 基础样式 */
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        
        /* 列表容器样式 */
        .technician-list {
            list-style: none;
            padding: 0;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
        }
        
        /* 单个技师卡片样式 */
        .technician-item {
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            transition: transform 0.3s;
        }
        
        .technician-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        /* 图片区域样式 */
        .technician-cover {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }
        
        /* 信息区域样式 */
        .technician-info {
            padding: 15px;
        }
        
        .technician-name {
            margin: 0 0 10px;
            font-size: 18px;
            color: #333;
        }
        
        .technician-desc {
            color: #666;
            margin-bottom: 15px;
            font-size: 14px;
        }
        
        /* 按钮样式 */
        .detail-btn {
            display: inline-block;
            padding: 8px 15px;
            background-color: #1890ff;
            color: white;
            text-decoration: none;
            border-radius: 4px;
            font-size: 14px;
        }
        
        .detail-btn:hover {
            background-color: #40a9ff;
        }
        
        /* 加载状态样式 */
        .loading {
            text-align: center;
            padding: 30px;
            font-size: 16px;
            color: #666;
        }
        
        /* 错误提示样式 */
        .error {
            text-align: center;
            padding: 20px;
            color: #f5222d;
            background: #fff1f0;
            border-radius: 4px;
            margin: 20px 0;
            display: none;
        }
    </style>
</head>

<body class="met-navfixed">
    <!--[if lte IE 8]>
            <div class="text-center padding-top-50 padding-bottom-50 bg-blue-grey-100">
                <p class="browserupgrade font-size-18">
                    你正在使用一个
                    <strong>
                        过时
                    </strong>
                    的浏览器。请
                    <a href="#"​ target="_blank">
                        升级您的浏览器
                    </a>
                    ，以提高您的体验。
                </p>
            </div>
        <![endif]-->
    <header id="header" class="header-fixed">
        <div class="container">
            <ul class="head-list">
                <li class="left tel">
                    <img src="images/1514354107.png" alt="">
                    <span>
                        全国咨询热线：
                    </span>
                    <em>
                        400-123-4567
                    </em>
                </li>
                <li class="right">
                    <ul>
                        <li>
                            <img src="images/1514355047.png" alt="一流的服务">
                            <span>
                                一流的服务
                            </span>
                        </li>
                        <li>
                            <img src="images/1514354958.png" alt="透明的价格">
                            <span>
                                透明的价格
                            </span>
                        </li>
                        <li>
                            <img src="images/1514354817.png" alt="重信守誉">
                            <span>
                                重信守誉
                            </span>
                        </li>
                        <li>
                            <img src="images/1514354461.png" alt="优质的技师">
                            <span>
                                优质的技师
                            </span>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </header>

    <nav class="navbar navbar-default met-nav navbar-fixed-top" role="navigation">
        <div class="container">
            <div class="row">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle hamburger hamburger-close collapsed"
                        data-target="#navbar-default-collapse" data-toggle="collapse">
                        <span class="sr-only">
                            Toggle navigation
                        </span>
                        <span class="hamburger-bar">
                        </span>
                    </button>
                    <a href="#" ​ class="navbar-brand navbar-logo vertical-align" title="中电金信有限公司(自适应手机端)">
                        <h1 class='hide'>
                            中电金信有限公司(自适应手机端)
                        </h1>
                        <div class="vertical-align-middle">
                            <img src="images/018.png" alt="中电金信有限公司(自适应手机端)" title="中电金信有限公司(自适应手机端)" />
                        </div>
                    </a>
                    <h2 class='hide'>
                    </h2>
                </div>
                <div class="collapse navbar-collapse navbar-collapse-toolbar" id="navbar-default-collapse">
                    <ul class="nav navbar-nav navbar-right navlist">
                        <li>
                            <a href="index.html" ​ title="网站首页" class="link">
                                网站首页
                            </a>
                        </li>
                        <li class="dropdown margin-left-20">
                            <a class="dropdown-toggle link " data-toggle="dropdown" data-hover="dropdown"
                                aria-expanded="false" href="about.html">
                                关于我们
                                <span class="caret">
                                </span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right bullet">
                                <li>
                                    <a href="about.html" ​ class="" title="公司简介">
                                        公司简介
                                    </a>
                                </li>
                                <li>
                                    <a href="message.html" ​ class="" title="在线留言">
                                        在线留言
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="dropdown margin-left-20">
                            <a class="dropdown-toggle link active" data-toggle="dropdown" data-hover="dropdown"
                                aria-expanded="false" href="product.html">
                                优质水会
                                <span class="caret">
                                </span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right bullet">
                                <li>
                                    <a href="productcate1.html" ​ class="" title="丽丝">
                                        丽丝水会
                                    </a>
                                </li>
                                <li>
                                    <a href="productcate2.html" ​ class="" title="威美斯">
                                        威美斯水会
                                    </a>
                                </li>
                                <li>
                                    <a href="productcate3.html" ​ class="" title="贝帮">
                                        贝帮水会
                                    </a>
                                </li>
                                <li>
                                    <a href="productcate4.html" ​ class="" title="月荷湾">
                                        月荷湾水会
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="dropdown margin-left-20">
                            <a class=" link " href="contact.html">
                                联系我们
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right bullet">
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
    <div class="met-banner banner-ny-h" data-height='' style=''>
        <div class="slick-slide">
            <img class="cover-image" src="images/lisi1.jpg" sizes="(max-width: 767px) 767px" alt="果树苗">
        </div>
    </div>

    
 
    <button type="button" class="btn btn-icon btn-primary btn-squared met-scroll-top hide">
        <i class="icon wb-chevron-up" aria-hidden="true">
        </i>
    </button>
    <script src="js/index.js"></script>
    <div class="container">
        <h1 style="text-align: center; margin-bottom: 30px;">技师列表</h1>
        
        <!-- 加载状态 -->
        <div id="loading" class="loading">
            <div class="spinner"></div>
            <p>正在加载技师数据...</p>
        </div>
        
        <!-- 错误提示 -->
        <div id="error" class="error"></div>
        
        <!-- 技师列表容器 -->
        <ul id="technician-list" class="technician-list"></ul>
    </div>

    <script>
        // 后端API配置
        const API_BASE_URL = 'http://127.0.0.1:7070';
        const TECH_LIST_API = `${API_BASE_URL}/html/list`;
        
        // 页面加载时获取数据
        document.addEventListener('DOMContentLoaded', function() {
            loadTechnicians();
        });

        // 加载技师列表
        async function loadTechnicians() {
            const loadingEl = document.getElementById('loading');
            const errorEl = document.getElementById('error');
            const listContainer = document.getElementById('technician-list');
            
            try {
                // 显示加载状态
                loadingEl.style.display = 'block';
                errorEl.style.display = 'none';
                listContainer.innerHTML = '';
                
                // 准备请求参数（可以根据需要添加筛选条件）
                const requestBody = {
                    // 示例筛选条件：
                    type: 1
                };
                
                // 发送POST请求到后端API
                const response = await fetch(TECH_LIST_API, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify(requestBody)
                });
                
                // 检查响应状态
                if (!response.ok) {
                    throw new Error(`请求失败: ${response.status}`);
                }
                
                // 解析JSON数据
                const result = await response.json();
                
                // 检查返回数据
                if (!result || !result.data) {
                    throw new Error('返回数据格式不正确');
                }
                
                // 隐藏加载状态
                loadingEl.style.display = 'none';
                
                // 处理空数据情况
                if (result.data.length === 0) {
                    listContainer.innerHTML = '<li style="grid-column:1/-1;text-align:center;">暂无技师数据</li>';
                    return;
                }
                
                // 遍历数据并生成li元素
                result.data.forEach(tech => {
                    const liElement = document.createElement('li');
                    liElement.className = 'technician-item';
                    
                    // 构建li标签内部内容
                    liElement.innerHTML = `
                        <figure class="widget-header cover">
                            <a href="productshow.html?id=${tech.id}" title="${tech.name}" target="_self">
                                <img class="technician-cover" src="${tech.main_img || 'picture/xiaofupo1.jpg'}" alt="${tech.name}">
                            </a>
                        </figure>
                        <div class="technician-info">
                            <h3 class="technician-name">${tech.name || '未命名技师'}</h3>
                            <p class="technician-desc">${tech.message || '暂无介绍'}</p>
                            <div class="widget-body-footer">
                                <a href="productshow.html?id=${tech.id}" class="detail-btn">查看详情</a>
                            </div>
                        </div>
                    `;
                    
                    // 将li元素添加到列表中
                    listContainer.appendChild(liElement);
                });
                
            } catch (error) {
                console.error('加载技师列表失败:', error);
                loadingEl.style.display = 'none';
                errorEl.textContent = `加载失败: ${error.message}`;
                errorEl.style.display = 'block';
            }
        }
    </script>

<footer>
    <div class="container text-center">
        <p>
            CopyRight &copy; 2020-2030 中电金信有限公司 版权所有
        </p>
        <p>
            ICP备XXXXXXXX号
        </p>
    </div>
</footer>
</body>

</html>